package com.nf.action;

import com.nf.entity.Teacher;
import com.nf.service.TeacherService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
@Scope("prototype")
public class TeacherAction extends ActionSupport{
   @Autowired
    private TeacherService teacherService=null;
   @Override
    public String execute() throws Exception{
       List<Teacher> teacherList=teacherService.getAllTeacher();
       System.out.println(teacherList.size());

       ActionContext.getContext().getValueStack().set("teacher",teacherList);
       return this.SUCCESS;
   }
}
